﻿
using System;

using Irony.Compiler;

namespace IronLua.Ast {

	public class SlotExpression : Expression {

		readonly Expression target;
		readonly Expression expression;

		public Expression Target {
			get { return target; }
		}

		public Expression Expression {
			get { return expression; }
		}

		public override LuaNodeType NodeType {
			get { return LuaNodeType.SlotExpression; }
		}

		public SlotExpression (CompilerContext context, NonTerminal nonTerminal, SourceLocation location, AstNodeList childNodes)
			: base (context, nonTerminal, location, childNodes)
		{
			target = ChildNodes [0].ToExpression ();
			expression = ChildNodes [2].ToExpression ();
		}

		public override void Accept (ILuaAstVisitor visitor)
		{
			visitor.VisitSlotExpression (this);
		}
	}
}
